package cn.labbook.bluetooth.util;

import java.util.Objects;

/**
 * @Author: zhangyang
 * @Date: 2023/4/13 15:40
 * @Desc:
 */
public class DoubleUtils {

    /**
     * 值小于等于0
     */
    public static boolean leZero(Double value) {
        if (Objects.isNull(value)) {
            return true;
        }
        return value <= 0;
    }

    public static boolean gtZero(Double value) {
        return !leZero(value);
    }

    public static Double getZeroIfNull(Double value) {
        if (leZero(value)) {
            return 0d;
        }
        return value;
    }

    public static void main(String[] args) {
        System.out.println(gtZero(0.1d));
    }

}
